cmake_minimum_required(VERSION 3.16)
project(Test_Project LANGUAGES CXX)

# C++ 编译器配置
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Qt 配置
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt6 REQUIRED COMPONENTS Widgets Gui Core SerialPort)

# third party 配置
find_package(yaml-cpp REQUIRED)

# 输出目录设定
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) # 可执行文件输出目录
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) # 动态库输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) # 静态库输出目录

# 静态链接库编译
add_subdirectory(${CMAKE_SOURCE_DIR}/cpp)
# 测试用例编译
add_subdirectory(${CMAKE_SOURCE_DIR}/example)

# 设置编译选项
add_compile_options("--Wall")

# 配置文件导出
# install(EXPORT MyLibTargets
#     FILE MyLibConfig.cmake
#     DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MyLib
# )